package aaaaaaaa;

import java.util.ArrayList;

public class bbb {
    public static void main(String[] args) {
        ArrayList<aaa> list = new ArrayList<>();
        list.add(new aaa(1,"张三"));
        list.add(new aaa(2,"李四"));
        list.add(new aaa(3,"王五"));
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).toString());
        }
        int index = 0;
        for (aaa a : list){
            if (a.getName().equals("张三")){
                index = list.indexOf(a);
            }
            aaa aaa = new aaa(1,"张三丰");
            list.set(index,aaa);
        }

        int indexs = 0;
        for (aaa a : list){
            if (a.getName().equals("王五")){
                indexs = list.indexOf(a);
            }
        }
        list.remove(indexs);
        for (int i = 0; i < list.size(); i++) {
            System.out.println("之后");
            System.out.println(list.get(i).toString());
        }
    }
}
